package com.supermap.guangzhou.weifang.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ListView;

/**
 * Created by XueQing Wang on 2018/5/30.
 */

/**
 * 仿微信删除/修改/查看列表
 *
 * @author wangxueqing
 */
public class CustomListView extends ListView {


    public CustomListView(Context context) {
        super(context);
    }

    public CustomListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    boolean isOnMeasure;
    //重新计算高度的具体方法,
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        isOnMeasure = true;
        Log.d("onMeasure", "onMeasure");
        super.onMeasure(widthMeasureSpec, expandSpec);
    }
    //摆放子View
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        Log.d("onLayout", "onLayout");
        isOnMeasure = false;
        super.onLayout(changed, l, t, r, b);
    }

    public boolean isOnMeasure(){
        return isOnMeasure;
    }

}